package com.wcar.system.controller;

import com.wcar.common.entity.FrontUser;
import com.wcar.common.entity.User;
import com.wcar.system.service.impl.UserServiceImpl;
import com.wcar.common.vo.Result;
import com.wcar.system.vo.PassVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/system/user")
public class UserController {
    @Autowired
    private UserServiceImpl loginService;
    @GetMapping("/selectByName/{name}")
    public Result<User> selectByName(@PathVariable String name){
        return loginService.login(name);
    }
    @GetMapping("/fontSelectByName")
    public Result<FrontUser> fontSelectByName(@RequestParam String name){
        return loginService.fontLogin(name);
    }
    @GetMapping("/selectById/{id}")
    public Result<User> selectById(@PathVariable Integer id){
        return loginService.selectById(id);
    }
    @GetMapping("/selectList")
    public Result<List<User>> selectAll(){
        return loginService.selectAll();
    }
    @PostMapping("/modifyPass")
    public Result<User> modifyPass(@RequestBody PassVo pass){
        System.out.println(pass);
        return loginService.modifyPass(pass);
    }
}
